home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # preinst script for cups
- #
- # see: dh_installdeb(1)
-
- set -e
-
- # summary of how this script can be called:
- # * <new-preinst> `install'
- # * <new-preinst> `install' <old-version>
- # * <new-preinst> `upgrade' <old-version>
- # * <old-preinst> `abort-upgrade' <new-version>
-
- # Remove a no-longer used conffile (from http://wiki.debian.org/DpkgConffileHandling)
- rm_conffile() {
- PKGNAME="$1"
- CONFFILE="$2"
- if [ -e "$CONFFILE" ]; then
- md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
- old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\'^ $CONFFILE[[:space:]]'{s/ obsolete$//;s/.* //p}\"`"
- if [ "$md5sum" != "$old_md5sum" ]; then
- echo "Obsolete conffile $CONFFILE has been modified by you."
- echo "Saving as $CONFFILE.dpkg-bak ..."
- mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
- else
- echo "Removing obsolete conffile $CONFFILE ..."
- rm -f "$CONFFILE"
- fi
- fi
- }
-
- case "$1" in
- install|upgrade)
- if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
- echo -n "Moving printer definition files..."
- mkdir -p /etc/cups/ppd || true
- if [ `ls /var/lib/cups/ppd | wc -l` -ne " 0" ]; then
- cp -a /var/lib/cups/ppd/* /etc/cups/ppd
- fi
- rm -rf /var/lib/cups/ppd
- echo "done."
- fi
-
- if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
- rmdir /var/lib/cups/logs || true
- fi
-
- # Remove dangling pdftops.conf symlink, which is obsolete anyway
- if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
- rm -f /etc/cups/pdftops.conf
- fi
-
- # does not need d-bus configuration, only sends signals
- if dpkg --compare-versions "$2" lt-nl '1.3.9-16'; then
- rm -f /etc/dbus-1/system.d/cups.conf
- fi
-
- # Obsolete symlinks, and they wreak havoc now
- if dpkg --compare-versions "$2" lt-nl '1.4.0-6'; then
- rm -f /usr/share/ppd/1-local-admin /usr/share/ppd/2-third-party
- fi
-
- # On Ubuntu, replace the obsolete init script (replaced by an upstart job)
- if [ "`lsb_release -is 2>/dev/null`" = "Ubuntu" ] && [ ! -L /etc/init.d/cups ] && dpkg --compare-versions "$2" le-nl "1.4.4-6"; then
- rm_conffile cups /etc/init.d/cups
- update-rc.d cups remove
- fi
-
- if dpkg --compare-versions "$2" le "1.4.4-7+squeeze2~" && [ -e /etc/cups/cupsd.conf ]; then
- # Move cupsd.conf away as it becomes a non-conffile
- mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.conffile-bak
- fi
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 0
- ;;
- esac
-
- # dh_installdeb will replace this with shell code automatically
- # generated by other debhelper scripts.
-
-
-
- exit 0
-
-
-